
import pandas as pd

def eval(file_path):
    df = pd.read_csv(file_path)
    length =len(df)
    acc = 0
    for index, row in df.iterrows():
        label = row['label_raw']
        predict = row['predict']
        predict = predict.strip('#')
        if(predict == label):
            acc += 1
        else:
            print('predict = ' + predict +' but label = ' + label)
    accuracy = float(acc / length)
    print('acc = '+str(accuracy))
    
if __name__ == '__main__':
    file = 'cmcc_predict_gpt.csv'
    eval(file)